package com.library.entity;

import javax.persistence.*;

/*
* 管理员类
* */

@Entity
@Table(name="administrator")
public class Administrator {
	private Integer administratorId;			//ID
	private String username;			//用户名
	private String password;		//密码
	private String name;	//姓名
	private String email;	//电子邮箱
	private Role role;		//角色
	private Boolean rank;	//等级  false为普通管理员 true为超级管理员
	private boolean state;			//状态

	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}

	@Column(unique = true)
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}


	@ManyToOne
	@JoinColumn(name="roleId")
	public Role getRole() {
		return role;
	}
	public void setRole(Role role) {
		this.role = role;
	}

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Integer getAdministratorId() {
		return administratorId;
	}

	public void setAdministratorId(Integer administratorId) {
		this.administratorId = administratorId;
	}

	public Boolean getRank() {
		return rank;
	}

	public void setRank(Boolean rank) {
		this.rank = rank;
	}

	@Column(unique = true)
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public boolean isState() {
		return state;
	}

	public void setState(boolean state) {
		this.state = state;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}
}
